// 存放容器组件
// WithCount容器组件


import { connect } from "react-redux";
import Count from '../comprents/count'

import { addFn } from "../redux/action";
// 获取数据
function mapStateToProps(state) {
  console.log(state);
  return {
    'shuibian':state.count,
  }
}

function mapDispatchToProps(dispatch) {
  // console.log(dispatch);
  return {
    // 把该方法包装起来返回
    add: (num) => {           //num来自谁调用（count中）
      console.log(num);
      dispatch(addFn(num)); // dispatch({type:ADD,num})
    }
  }
  
}

export const WithCount = connect(mapStateToProps, mapDispatchToProps)(Count);
 